package com.example.composableexample

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.blur
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp

/**
 * author: LiLiang
 * createTime: 2022/9/14-9:27
 * remark:
 **/

@Preview
@Composable
fun BlurExample() {

    Box() {
        Image(
            painter = painterResource(id = R.drawable.jetpack),
            contentDescription = "",
            modifier = Modifier
                .fillMaxSize()
                .blur(100.dp),
            contentScale = ContentScale.Crop
        )
        Card(
            elevation = CardDefaults.cardElevation(18.dp),
            shape = RoundedCornerShape(30.dp),
            modifier = Modifier
                .align(Alignment.Center),
            colors = CardDefaults.cardColors(containerColor = Color.Transparent)
        ) {
            Image(
                painter = painterResource(id = R.drawable.jetpack),
                contentDescription = "",
                contentScale = ContentScale.FillBounds
            )
        }
    }
}